package tree;

import javax.swing.*;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class Clertree implements ActionListener {
	
	static int clertreepoints = 0;
	int totalpoints = 40;
	boolean recentreset = false;
	
	public static int getclerpoints() {
		return clertreepoints;
	}
	
	Skill arbitr = Clericskills.arbitration();
	Skill coh = Clericskills.coh();
	Skill concen = Clericskills.concentration();
	Skill cop = Clericskills.cop();
	Skill dire = Clericskills.dire();
	Skill divine = Clericskills.divine();
	Skill divinemas = Clericskills.divinemastery();
	Skill endur = Clericskills.endurance();
	Skill focused = Clericskills.focused();
	Skill goddess = Clericskills.goddess();
	Skill healing = Clericskills.healing();
	Skill judge = Clericskills.judge();
	Skill light = Clericskills.light();
	Skill links = Clericskills.links();
	Skill mindtra = Clericskills.mindtraining();
	Skill nimble = Clericskills.nimble();
	Skill orbs = Clericskills.orbs();
	Skill pleasure = Clericskills.pleasure();
	Skill priest = Clericskills.priest();
	Skill recovery = Clericskills.recovery();
	Skill repercus = Clericskills.repercussion();
	Skill revita = Clericskills.revitalize();
	Skill salvat = Clericskills.salvation();
	Skill storm = Clericskills.storm();
	Skill swift = Clericskills.swiftness();
	Skill uplift = Clericskills.uplift();
	Skill whirl = Clericskills.whirlpool();
	
	
	
	
	
	static JFrame frame;
	JPanel masterypanel, skills, row1,row2,row3,row4,row5,row6,row7, masrow1,masrow2,masrow3,
	masrow4,masrow5,masrow6,masrow7;
	
	JButton resetall, reset, def, zerk, cleric, sorc, sin, ligh, divin, revit, repercu, divinema, focuse, endu, pleasur,
			judg, copp, cohh, mindtr, healin, dir, conce, arbit, link, recover, orb, goddes, uplif, whir, salva, swif,
			pries, stor, nimbl;
	
	JLabel title1, title2, info, lig, divi, revi, reperc, divinem , arr1, arr2, arr3, focus, end, pleasu, jud, coppp,
			cohhh, mindt, heali, di, conc, arbi, lin, recove, or, godde, upli, whi, salv, swi, prie, sto, nimb, possess,
			posses, heal1, heal11, heal2, heal22, heal3, heal33, chain, chai, cross, cros, holy1, holy11, holy2, holy22,
			res1, res11, res2, res22;
	
	static JPanel allpanels;
	
	public JPanel createContentPane (){
		
		totalpoints = 40;
		clertreepoints = 0;
		ImageIcon img;
		Image test;
		Image newimg;
		
		ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);

        allpanels = new JPanel();
        allpanels.setLayout(null);
		
        title1 = new JLabel("Actives/Passives");
        title1.setLocation(5, 0);
        title1.setSize(430,20);
        title1.setHorizontalAlignment(0);
        title1.setOpaque(true);
        title1.setBackground(Color.gray);
        allpanels.add(title1);
        
        title2 = new JLabel("Masteries");
        title2.setLocation(435, 0);
        title2.setSize(110,20);
        title2.setHorizontalAlignment(0);
        title2.setOpaque(true);
        title2.setBackground(Color.gray);
        allpanels.add(title2);
        
        skills = new JPanel();
        skills.setLayout(null);
        skills.setSize(430, 430);
        skills.setLocation(5,20);
        allpanels.add(skills);
        
        //masteries
        masterypanel = new JPanel();
        masterypanel.setLayout(null);
        masterypanel.setSize(110, 430);
        masterypanel.setLocation(435,20);
        allpanels.add(masterypanel);
        
      //masteries
        masrow1 = new JPanel();
        masrow1.setLayout(null);
        masrow1.setLocation(0, 0);
        masrow1.setSize(110, 60);
        masrow1.setBackground(Color.lightGray);
        masrow1.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow1);
        
      //Possession
        img = new ImageIcon(getClass().getResource("/cleric/possess.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        possess = new JLabel();
        possess.setSize(40,40);
        possess.setToolTipText("<html>Possession<br>Activates Possession for 15 secs. Physical and Magic Attack increase by 5% and<br>" +
        						"incoming damage decreases by 10%. During Possession, some skills become more powerful or the EP<br>" +
        						"consumption decreases. Additionally, whenever Possession is activated, the cooldown timers of Circle<br>" +
        						"of Punishment, Circle of Healing and Salvation are instantly resetted.<br>Cooldown: 120 secs<br>" +
        						"Requires 5+ points in cleric</html>");
        possess.setLocation(10, 10);
        possess.setOpaque(true);
        possess.setBackground(new Color(128,128,128,175));
        masrow1.add(possess);
        
        posses = new JLabel((Icon) img);
        posses.setSize(40,40);
        posses.setLocation(10, 10);
        masrow1.add(posses);
        
      //Heal 1
        img = new ImageIcon(getClass().getResource("/cleric/heal.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        heal1 = new JLabel();
        heal1.setSize(40,40);
        heal1.setToolTipText("<html>Heal<br>Restores HP equal to 150% of Magic Attack plus 160 Hit Points to all allies in a designated<br>" +
        						"radius of 3m within a range of 20m.<br>Energy Cost: 50<br>Cast Time: 1 secs<br>Cooldown: 5 secs<br>" +
        						"Requires 5+ points in cleric</html>");
        heal1.setLocation(60, 10);
        heal1.setOpaque(true);
        heal1.setBackground(new Color(128,128,128,175));
        masrow1.add(heal1);
        
        heal11 = new JLabel((Icon) img);
        heal11.setSize(40,40);
        heal11.setLocation(60, 10);
        masrow1.add(heal11);
        
      //mastrow2
        masrow2 = new JPanel();
        masrow2.setLayout(null);
        masrow2.setLocation(0, 60);
        masrow2.setSize(110, 60);
        masrow2.setBackground(Color.lightGray);
        masrow2.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow2);
        
      //Style mastery
        img = new ImageIcon(getClass().getResource("/cleric/stylemastery.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        cross = new JLabel();
        cross.setSize(40,40);
        cross.setToolTipText("<html>Style Mastery: Cleric<br>Allows you learn skills of other styles.<br>" +
        						"Requires 10+ points in cleric</html>");
        cross.setLocation(35, 10);
        cross.setOpaque(true);
        cross.setBackground(new Color(128,128,128,175));
        masrow2.add(cross);
        
        cros = new JLabel((Icon) img);
        cros.setSize(40,40);
        cros.setLocation(35, 10);
        masrow2.add(cros);
        
      //mastrow3
        masrow3 = new JPanel();
        masrow3.setLayout(null);
        masrow3.setLocation(0, 120);
        masrow3.setSize(110, 60);
        masrow3.setBackground(Color.lightGray);
        masrow3.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow3);
        
        
      //Chain mastery
        img = new ImageIcon(getClass().getResource("/cleric/chainmastery.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        chain = new JLabel();
        chain.setSize(40,40);
        chain.setToolTipText("<html>Chain Armor Mastery<br>Allows you to equip chain armor.<br>" +
        						"Requires 15+ points in cleric</html>");
        chain.setLocation(10, 10);
        chain.setOpaque(true);
        chain.setBackground(new Color(128,128,128,175));
        masrow3.add(chain);
        
        chai = new JLabel((Icon) img);
        chai.setSize(40,40);
        chai.setLocation(10, 10);
        masrow3.add(chai);
        
      //Heal 2
        img = new ImageIcon(getClass().getResource("/cleric/heal.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        heal2 = new JLabel();
        heal2.setSize(40,40);
        heal2.setToolTipText("<html>Heal 2<br>Restores HP equal to 160% of Magic Attack plus 200 Hit Points to all allies in a designated<br>" +
        						"radius of 3m within a range of 20m.<br>Energy Cost: 75<br>Cast Time: 1 secs<br>Cooldown: 4 secs<br>" +
        						"Requires 15+ points in cleric</html>");
        heal2.setLocation(60, 10);
        heal2.setOpaque(true);
        heal2.setBackground(new Color(128,128,128,175));
        masrow3.add(heal2);
        
        heal22 = new JLabel((Icon) img);
        heal22.setSize(40,40);
        heal22.setLocation(60, 10);
        masrow3.add(heal22);
        
      //mastrow4
        masrow4 = new JPanel();
        masrow4.setLayout(null);
        masrow4.setLocation(0, 180);
        masrow4.setSize(110, 60);
        masrow4.setBackground(Color.lightGray);
        masrow4.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow4);
        
        
      //Holy Striking 1
        img = new ImageIcon(getClass().getResource("/cleric/holystriking.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        holy1 = new JLabel();
        holy1.setSize(40,40);
        holy1.setToolTipText("<html>Holy Striking<br>Modifies Possession to last for 20 secs while increasing Physical and Magic<br>" +
        					"Attack by 8% and incoming damage decreases by 15%. You have 25% chance<br>to deal 100% " +
        					"of Magic Attack on Physical Attacks.<br>" +
        						"Requires 20+ points in cleric</html>");
        holy1.setLocation(35, 10);
        holy1.setOpaque(true);
        holy1.setBackground(new Color(128,128,128,175));
        masrow4.add(holy1);
        
        holy11 = new JLabel((Icon) img);
        holy11.setSize(40,40);
        holy11.setLocation(35, 10);
        masrow4.add(holy11);
        
      //mastrow5
        masrow5 = new JPanel();
        masrow5.setLayout(null);
        masrow5.setLocation(0, 240);
        masrow5.setSize(110, 60);
        masrow5.setBackground(Color.lightGray);
        masrow5.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow5);
        
      //Resurrect
        img = new ImageIcon(getClass().getResource("/cleric/resurrect.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        res1 = new JLabel();
        res1.setSize(40,40);
        res1.setToolTipText("<html>Miracle: Combat Ressurrection<br>Ressurrects 1 party members within 5 m. with holy power and restores their HP by 20%.<br>" +
        						"Energy Cost: 60<br>Cast Time: 3 secs<br>Cooldown: 20 mins<br>" +
        						"Requires 25+ points in cleric</html>");
        res1.setLocation(10, 10);
        res1.setOpaque(true);
        res1.setBackground(new Color(128,128,128,175));
        masrow5.add(res1);
        
        res11 = new JLabel((Icon) img);
        res11.setSize(40,40);
        res11.setLocation(10, 10);
        masrow5.add(res11);
        
        
        
      //Heal 3
        img = new ImageIcon(getClass().getResource("/cleric/heal.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        heal3 = new JLabel();
        heal3.setSize(40,40);
        heal3.setToolTipText("<html>Heal 3<br>Restores HP equal to 170% of Magic Attack plus 230 Hit Points to all allies in a designated<br>" +
        						"radius of 3m within a range of 20m.<br>Energy Cost: 100<br>Cast Time: 1 secs<br>Cooldown: 3 secs<br>" +
        						"Requires 25+ points in cleric</html>");
        heal3.setLocation(60, 10);
        heal3.setOpaque(true);
        heal3.setBackground(new Color(128,128,128,175));
        masrow5.add(heal3);
        
        heal33 = new JLabel((Icon) img);
        heal33.setSize(40,40);
        heal33.setLocation(60, 10);
        masrow5.add(heal33);
        
      //mastrow6
        masrow6 = new JPanel();
        masrow6.setLayout(null);
        masrow6.setLocation(0, 300);
        masrow6.setSize(110, 60);
        masrow6.setBackground(Color.lightGray);
        masrow6.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow6);
        
      //Holy Striking 2
        img = new ImageIcon(getClass().getResource("/cleric/holystriking.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        holy2 = new JLabel();
        holy2.setSize(40,40);
        holy2.setToolTipText("<html>Holy Striking 2<br>Modifies Possession to last for 25 secs while increasing Physical and Magic<br>" +
        					"Attack by 10% and incoming damage decreases by 20%. You have 50% chance<br>to deal 100% " +
        					"of Magic Attack on Physical Attacks.<br>" +
        						"Requires 30+ points in cleric</html>");
        holy2.setLocation(35, 10);
        holy2.setOpaque(true);
        holy2.setBackground(new Color(128,128,128,175));
        masrow6.add(holy2);
        
        holy22 = new JLabel((Icon) img);
        holy22.setSize(40,40);
        holy22.setLocation(35, 10);
        masrow6.add(holy22);
        
      //mastrow7
        masrow7 = new JPanel();
        masrow7.setLayout(null);
        masrow7.setLocation(0, 360);
        masrow7.setSize(110, 60);
        masrow7.setBackground(Color.lightGray);
        masrow7.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow7);
        
      //Resurrect 2
        img = new ImageIcon(getClass().getResource("/cleric/resurrect.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        res2 = new JLabel();
        res2.setSize(40,40);
        res2.setToolTipText("<html>Miracle: Combat Ressurrection 2<br>Ressurrects 3 party members within 5 m. with holy power and restores their HP by 20%.<br>" +
        						"Energy Cost: 72<br>Cast Time: 3 secs<br>Cooldown: 20 mins<br>" +
        						"Requires 35+ points in cleric</html>");
        res2.setLocation(35, 10);
        res2.setOpaque(true);
        res2.setBackground(new Color(128,128,128,175));
        masrow7.add(res2);
        
        res22 = new JLabel((Icon) img);
        res22.setSize(40,40);
        res22.setLocation(35, 10);
        masrow7.add(res22);
        
        
        
        
        def = new JButton();
        def.setText("Defender(0)");
        def.setSize(110,20);
        def.setLocation(5, 450);
        def.setHorizontalAlignment( SwingConstants.LEFT );
        def.addActionListener(this);
        allpanels.add(def);
        
        zerk = new JButton();
        zerk.setText("Berserker(0)");
        zerk.setSize(120,20);
        zerk.setLocation(115, 450);
        zerk.setHorizontalAlignment( SwingConstants.LEFT );
        zerk.addActionListener(this);
        allpanels.add(zerk);
        
        cleric = new JButton();
        cleric.setText("Cleric(0)");
        cleric.setSize(90,20);
        cleric.setLocation(235, 450);
        cleric.setHorizontalAlignment( SwingConstants.CENTER );
        cleric.addActionListener(this);
        allpanels.add(cleric);
        
        sorc = new JButton();
        sorc.setText("Sorcerer(0)");
        sorc.setSize(110,20);
        sorc.setLocation(325, 450);
        sorc.setHorizontalAlignment( SwingConstants.LEFT );
        sorc.addActionListener(this);
        allpanels.add(sorc);
        
        sin = new JButton();
        sin.setText("Assassin(" + Sintree.getsinpoints() + ")");
        sin.setSize(110,20);
        sin.setLocation(435, 450);
        sin.setHorizontalAlignment( SwingConstants.LEFT );
        sin.addActionListener(this);
        allpanels.add(sin);
        
        
        info = new JLabel();
        info.setText("<html>Points Used: " + clertreepoints + "<br>Points Left: " + (totalpoints-(clertreepoints)) + "</html>");
        info.setSize(550,40);
        info.setHorizontalAlignment( SwingConstants.CENTER );
        info.setLocation(0, 470);
        allpanels.add(info);
        
        reset = new JButton();
        reset.setText("Reset Tree");
        reset.setSize(100, 20);
        reset.setLocation(225, 510);
        reset.setHorizontalAlignment( SwingConstants.CENTER );
        reset.addActionListener(this);
        allpanels.add(reset);
        
        resetall = new JButton("Reset All");
        resetall.setSize(100, 20);
        resetall.setLocation(225, 530);
        resetall.setHorizontalAlignment( SwingConstants.CENTER );
        resetall.addActionListener(this);
        allpanels.add(resetall);
        
        
        
        //row1
        row1 = new JPanel();
        row1.setLayout(null);
        row1.setLocation(0, 0);
        row1.setSize(430, 60);
        row1.setBackground(Color.lightGray);
        row1.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, Color.BLACK));
        skills.add(row1);
        
      //Hammer of light
        img = new ImageIcon(getClass().getResource("/cleric/light.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        ligh = new JButton((Icon) img);
        ligh.setToolTipText("<html>" + light.popup() + "</html>");
        ligh.setSize(40, 40);
        ligh.setLocation(10, 10);
        ligh.addActionListener(this);
        row1.add(ligh);
        
        lig = new JLabel();
        lig.setText(light.getlv() + "/" + light.getmax());
        lig.setSize(20,20);
        lig.setLocation(50, 30);
        row1.add(lig);
        
      //Divine Punishment
        img = new ImageIcon(getClass().getResource("/cleric/divine.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        divin = new JButton((Icon) img);
        divin.setToolTipText("<html>" + divine.popup() + "</html>");
        divin.setSize(40, 40);
        divin.setLocation(150, 10);
        divin.addActionListener(this);
        row1.add(divin);
        
        divi = new JLabel();
        divi.setText(divine.getlv() + "/" + divine.getmax());
        divi.setSize(20,20);
        divi.setLocation(190, 30);
        row1.add(divi);
        
      //Revitalize
        img = new ImageIcon(getClass().getResource("/cleric/revitalize.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        revit = new JButton((Icon) img);
        revit.setToolTipText("<html>" + revita.popup() + "</html>");
        revit.setSize(40, 40);
        revit.setLocation(220, 10);
        revit.addActionListener(this);
        row1.add(revit);
        
        revi = new JLabel();
        revi.setText(revita.getlv() + "/" + revita.getmax());
        revi.setSize(20,20);
        revi.setLocation(260, 30);
        row1.add(revi);
        
      //Repercussion
        img = new ImageIcon(getClass().getResource("/cleric/repercussion.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        repercu = new JButton((Icon) img);
        repercu.setToolTipText("<html>" + repercus.popup() + "</html>");
        repercu.setSize(40, 40);
        repercu.setLocation(290, 10);
        repercu.addActionListener(this);
        row1.add(repercu);
        
        reperc = new JLabel();
        reperc.setText(repercus.getlv() + "/" + repercus.getmax());
        reperc.setSize(20,20);
        reperc.setLocation(330, 30);
        row1.add(reperc);
        
      //Divine Mastery
        img = new ImageIcon(getClass().getResource("/cleric/divinemastery.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        divinema = new JButton((Icon) img);
        divinema.setToolTipText("<html>" + divinemas.popup() + "</html>");
        divinema.setSize(40, 40);
        divinema.setLocation(360, 10);
        divinema.addActionListener(this);
        row1.add(divinema);
        
        divinem = new JLabel();
        divinem.setText(divinemas.getlv() + "/" + divinemas.getmax());
        divinem.setSize(20,20);
        divinem.setLocation(400, 30);
        row1.add(divinem);
        
      //row2
        row2 = new JPanel();
        row2.setLayout(null);
        row2.setLocation(0, 60);
        row2.setSize(430, 60);
        row2.setBackground(Color.lightGray);
        row2.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row2);
        
        img = new ImageIcon(getClass().getResource("/cleric/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 58,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr1 = new JLabel((Icon) img);
        arr1.setSize(20,58);
        arr1.setLocation(20, 1);
        row2.add(arr1);
        
      //Focused Strike
        img = new ImageIcon(getClass().getResource("/cleric/focused.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        focuse = new JButton((Icon) img);
        focuse.setToolTipText("<html>" + focused.popup() + "</html>");
        focuse.setSize(40, 40);
        focuse.setLocation(80, 10);
        focuse.addActionListener(this);
        row2.add(focuse);
        
        focus = new JLabel();
        focus.setText(focused.getlv() + "/" + focused.getmax());
        focus.setSize(20,20);
        focus.setLocation(120, 30);
        row2.add(focus);
        
        img = new ImageIcon(getClass().getResource("/cleric/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 58,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr2 = new JLabel((Icon) img);
        arr2.setSize(20,58);
        arr2.setLocation(160, 1);
        row2.add(arr2);
        
        img = new ImageIcon(getClass().getResource("/cleric/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 58,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr3 = new JLabel((Icon) img);
        arr3.setSize(20,58);
        arr3.setLocation(230, 1);
        row2.add(arr3);
        
      //Endurance
        img = new ImageIcon(getClass().getResource("/cleric/endurance.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        endu = new JButton((Icon) img);
        endu.setToolTipText("<html>" + endur.popup() + "</html>");
        endu.setSize(40, 40);
        endu.setLocation(290, 10);
        endu.addActionListener(this);
        row2.add(endu);
        
        end = new JLabel();
        end.setText(endur.getlv() + "/" + endur.getmax());
        end.setSize(20,20);
        end.setLocation(330, 30);
        row2.add(end);
        
      //Pleasure of Pain
        img = new ImageIcon(getClass().getResource("/cleric/pleasure.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        pleasur = new JButton((Icon) img);
        pleasur.setToolTipText("<html>" + pleasure.popup() + "</html>");
        pleasur.setSize(40, 40);
        pleasur.setLocation(360, 10);
        pleasur.addActionListener(this);
        row2.add(pleasur);
        
        pleasu = new JLabel();
        pleasu.setText(pleasure.getlv() + "/" + pleasure.getmax());
        pleasu.setSize(20,20);
        pleasu.setLocation(400, 30);
        row2.add(pleasu);
        
      //row3
        row3 = new JPanel();
        row3.setLayout(null);
        row3.setLocation(0, 120);
        row3.setSize(430, 60);
        row3.setBackground(Color.lightGray);
        row3.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row3);
        
        img = new ImageIcon(getClass().getResource("/cleric/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 58,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr3 = new JLabel((Icon) img);
        arr3.setSize(20,58);
        arr3.setLocation(90, 1);
        row3.add(arr3);
        
      //Hammer of Judgement
        img = new ImageIcon(getClass().getResource("/cleric/judge.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        judg = new JButton((Icon) img);
        judg.setToolTipText("<html>" + judge.popup() + "</html>");
        judg.setSize(40, 40);
        judg.setLocation(10, 10);
        judg.addActionListener(this);
        row3.add(judg);
        
        jud = new JLabel();
        jud.setText(judge.getlv() + "/" + judge.getmax());
        jud.setSize(20,20);
        jud.setLocation(50, 30);
        row3.add(jud);
        
      //Circle of Punishment
        img = new ImageIcon(getClass().getResource("/cleric/cop.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        copp = new JButton((Icon) img);
        copp.setToolTipText("<html>" + cop.popup() + "</html>");
        copp.setSize(40, 40);
        copp.setLocation(150, 10);
        copp.addActionListener(this);
        row3.add(copp);
        
        coppp = new JLabel();
        coppp.setText(cop.getlv() + "/" + cop.getmax());
        coppp.setSize(20,20);
        coppp.setLocation(190, 30);
        row3.add(coppp);
        
      //Circle of Healing
        img = new ImageIcon(getClass().getResource("/cleric/coh.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        cohh = new JButton((Icon) img);
        cohh.setToolTipText("<html>" + coh.popup() + "</html>");
        cohh.setSize(40, 40);
        cohh.setLocation(220, 10);
        cohh.addActionListener(this);
        row3.add(cohh);
        
        cohhh = new JLabel();
        cohhh.setText(coh.getlv() + "/" + coh.getmax());
        cohhh.setSize(20,20);
        cohhh.setLocation(260, 30);
        row3.add(cohhh);
        
      //Mind Training
        img = new ImageIcon(getClass().getResource("/cleric/mindtraining.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        mindtr = new JButton((Icon) img);
        mindtr.setToolTipText("<html>" + mindtra.popup() + "</html>");
        mindtr.setSize(40, 40);
        mindtr.setLocation(360, 10);
        mindtr.addActionListener(this);
        row3.add(mindtr);
        
        mindt = new JLabel();
        mindt.setText(mindtra.getlv() + "/" + mindtra.getmax());
        mindt.setSize(20,20);
        mindt.setLocation(400, 30);
        row3.add(mindt);
        
      //row4
        row4 = new JPanel();
        row4.setLayout(null);
        row4.setLocation(0, 180);
        row4.setSize(430, 60);
        row4.setBackground(Color.lightGray);
        row4.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row4);
        
        img = new ImageIcon(getClass().getResource("/cleric/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 58,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr1 = new JLabel((Icon) img);
        arr1.setSize(20,58);
        arr1.setLocation(20, 1);
        row4.add(arr1);
        
      //Healing Strike
        img = new ImageIcon(getClass().getResource("/cleric/healing.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        healin = new JButton((Icon) img);
        healin.setToolTipText("<html>" + healing.popup() + "</html>");
        healin.setSize(40, 40);
        healin.setLocation(80, 10);
        healin.addActionListener(this);
        row4.add(healin);
        
        heali = new JLabel();
        heali.setText(healing.getlv() + "/" + healing.getmax());
        heali.setSize(20,20);
        heali.setLocation(120, 30);
        row4.add(heali);
        
      //Dire Recovery
        img = new ImageIcon(getClass().getResource("/cleric/dire.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        dir = new JButton((Icon) img);
        dir.setToolTipText("<html>" + dire.popup() + "</html>");
        dir.setSize(40, 40);
        dir.setLocation(220, 10);
        dir.addActionListener(this);
        row4.add(dir);
        
        di = new JLabel();
        di.setText(dire.getlv() + "/" + dire.getmax());
        di.setSize(20,20);
        di.setLocation(260, 30);
        row4.add(di);
        
      //Concentration
        img = new ImageIcon(getClass().getResource("/cleric/concentration.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        conce = new JButton((Icon) img);
        conce.setToolTipText("<html>" + concen.popup() + "</html>");
        conce.setSize(40, 40);
        conce.setLocation(290, 10);
        conce.addActionListener(this);
        row4.add(conce);
        
        conc = new JLabel();
        conc.setText(concen.getlv() + "/" + concen.getmax());
        conc.setSize(20,20);
        conc.setLocation(330, 30);
        row4.add(conc);
        
      //arbitration
        img = new ImageIcon(getClass().getResource("/cleric/arbitration.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arbit = new JButton((Icon) img);
        arbit.setToolTipText("<html>" + arbitr.popup() + "</html>");
        arbit.setSize(40, 40);
        arbit.setLocation(360, 10);
        arbit.addActionListener(this);
        row4.add(arbit);
        
        arbi = new JLabel();
        arbi.setText(arbitr.getlv() + "/" + arbitr.getmax());
        arbi.setSize(20,20);
        arbi.setLocation(400, 30);
        row4.add(arbi);
        
        img = new ImageIcon(getClass().getResource("/cleric/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 20,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr3 = new JLabel((Icon) img);
        arr3.setSize(20,20);
        arr3.setLocation(230, 230);
        skills.add(arr3,0);
        
        
      //row5
        row5 = new JPanel();
        row5.setLayout(null);
        row5.setLocation(0, 240);
        row5.setSize(430, 60);
        row5.setBackground(Color.lightGray);
        row5.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row5);
        
      //Links
        img = new ImageIcon(getClass().getResource("/cleric/links.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        link = new JButton((Icon) img);
        link.setToolTipText("<html>" + links.popup() + "</html>");
        link.setSize(40, 40);
        link.setLocation(10, 10);
        link.addActionListener(this);
        row5.add(link);
        
        lin = new JLabel();
        lin.setText(links.getlv() + "/" + links.getmax());
        lin.setSize(20,20);
        lin.setLocation(50, 30);
        row5.add(lin);
        
      //Miraculous Recovery
        img = new ImageIcon(getClass().getResource("/cleric/recovery.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        recover = new JButton((Icon) img);
        recover.setToolTipText("<html>" + recovery.popup() + "</html>");
        recover.setSize(40, 40);
        recover.setLocation(80, 10);
        recover.addActionListener(this);
        row5.add(recover);
        
        recove = new JLabel();
        recove.setText(recovery.getlv() + "/" + recovery.getmax());
        recove.setSize(20,20);
        recove.setLocation(120, 30);
        row5.add(recove);
        
      //Orbs
        img = new ImageIcon(getClass().getResource("/cleric/orbs.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        orb = new JButton((Icon) img);
        orb.setToolTipText("<html>" + orbs.popup() + "</html>");
        orb.setSize(40, 40);
        orb.setLocation(150, 10);
        orb.addActionListener(this);
        row5.add(orb);
        
        or = new JLabel();
        or.setText(orbs.getlv() + "/" + orbs.getmax());
        or.setSize(20,20);
        or.setLocation(190, 30);
        row5.add(or);
        
      //goddess
        img = new ImageIcon(getClass().getResource("/cleric/goddess.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        goddes = new JButton((Icon) img);
        goddes.setToolTipText("<html>" + goddess.popup() + "</html>");
        goddes.setSize(40, 40);
        goddes.setLocation(220, 10);
        goddes.addActionListener(this);
        row5.add(goddes);
        
        godde = new JLabel();
        godde.setText(goddess.getlv() + "/" + goddess.getmax());
        godde.setSize(20,20);
        godde.setLocation(260, 30);
        row5.add(godde);
        
      //uplift
        img = new ImageIcon(getClass().getResource("/cleric/uplift.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        uplif = new JButton((Icon) img);
        uplif.setToolTipText("<html>" + uplift.popup() + "</html>");
        uplif.setSize(40, 40);
        uplif.setLocation(360, 10);
        uplif.addActionListener(this);
        row5.add(uplif);
        
        upli = new JLabel();
        upli.setText(uplift.getlv() + "/" + uplift.getmax());
        upli.setSize(20,20);
        upli.setLocation(400, 30);
        row5.add(upli);
        
      //row6
        row6 = new JPanel();
        row6.setLayout(null);
        row6.setLocation(0, 300);
        row6.setSize(430, 60);
        row6.setBackground(Color.lightGray);
        row6.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row6);
        
      //whirlpool
        img = new ImageIcon(getClass().getResource("/cleric/whirlpool.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        whir = new JButton((Icon) img);
        whir.setToolTipText("<html>" + whirl.popup() + "</html>");
        whir.setSize(40, 40);
        whir.setLocation(10, 10);
        whir.addActionListener(this);
        row6.add(whir);
        
        whi = new JLabel();
        whi.setText(whirl.getlv() + "/" + whirl.getmax());
        whi.setSize(20,20);
        whi.setLocation(50, 30);
        row6.add(whi);
        
      //Salvation
        img = new ImageIcon(getClass().getResource("/cleric/salvation.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        salva = new JButton((Icon) img);
        salva.setToolTipText("<html>" + salvat.popup() + "</html>");
        salva.setSize(40, 40);
        salva.setLocation(220, 10);
        salva.addActionListener(this);
        row6.add(salva);
        
        salv = new JLabel();
        salv.setText(salvat.getlv() + "/" + salvat.getmax());
        salv.setSize(20,20);
        salv.setLocation(260, 30);
        row6.add(salv);
        
      //Swiftness
        img = new ImageIcon(getClass().getResource("/cleric/swiftness.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        swif = new JButton((Icon) img);
        swif.setToolTipText("<html>" + swift.popup() + "</html>");
        swif.setSize(40, 40);
        swif.setLocation(290, 10);
        swif.addActionListener(this);
        row6.add(swif);
        
        swi = new JLabel();
        swi.setText(swift.getlv() + "/" + swift.getmax());
        swi.setSize(20,20);
        swi.setLocation(330, 30);
        row6.add(swi);
        
      //Priest of Brune
        img = new ImageIcon(getClass().getResource("/cleric/priest.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        pries = new JButton((Icon) img);
        pries.setToolTipText("<html>" + priest.popup() + "</html>");
        pries.setSize(40, 40);
        pries.setLocation(360, 10);
        pries.addActionListener(this);
        row6.add(pries);
        
        prie = new JLabel();
        prie.setText(priest.getlv() + "/" + priest.getmax());
        prie.setSize(20,20);
        prie.setLocation(400, 30);
        row6.add(prie);
        
      //row7
        row7 = new JPanel();
        row7.setLayout(null);
        row7.setLocation(0, 360);
        row7.setSize(430, 60);
        row7.setBackground(Color.lightGray);
        row7.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row7);
        
      //Storm
        img = new ImageIcon(getClass().getResource("/cleric/storm.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        stor = new JButton((Icon) img);
        stor.setToolTipText("<html>" + storm.popup() + "</html>");
        stor.setSize(40, 40);
        stor.setLocation(80, 10);
        stor.addActionListener(this);
        row7.add(stor);
        
        sto = new JLabel();
        sto.setText(storm.getlv() + "/" + storm.getmax());
        sto.setSize(20,20);
        sto.setLocation(120, 30);
        row7.add(sto);
        
      //Nimble healer
        img = new ImageIcon(getClass().getResource("/cleric/nimble.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        nimbl = new JButton((Icon) img);
        nimbl.setToolTipText("<html>" + nimble.popup() + "</html>");
        nimbl.setSize(40, 40);
        nimbl.setLocation(360, 10);
        nimbl.addActionListener(this);
        row7.add(nimbl);
        
        nimb = new JLabel();
        nimb.setText(nimble.getlv() + "/" + nimble.getmax());
        nimb.setSize(20,20);
        nimb.setLocation(400, 30);
        row7.add(nimb);
        
        
        
        
        allpanels.setOpaque(true);
        return allpanels;
        
        
        
	}
	
	public void updatecler() {
		int allpoints = (Deftree.getdefpoints()+Sintree.getsinpoints()+clertreepoints+Sorctree.getsorcpoints()+Zerktree.getzerkpoints());
		info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
		sin.setText("Assassin(" + Sintree.getsinpoints() + ")");
		def.setText("Defender(" + Deftree.getdefpoints() + ")");
		sorc.setText("Sorcerer(" + Sorctree.getsorcpoints() + ")");
		zerk.setText("Berserker(" + Zerktree.getzerkpoints() + ")");
		
	}
	
	public void recentset() {
		recentreset = true;
	}
	
	public void actionPerformed(ActionEvent e) {
		int allpoints = (clertreepoints+Sintree.getsinpoints()+Deftree.getdefpoints()+Sorctree.getsorcpoints()+Zerktree.getzerkpoints());
		
		if(e.getSource() == reset) {
			clertreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
	        Alltrees.resetcler();
			
        }
		if(e.getSource() == sin) {
			//deftreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
			recentreset = false;
	        Alltrees.switchsin();
        } else if(e.getSource() == resetall) {
			//sintreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
	        Alltrees.resetall(); 
			
        }else if(e.getSource() == def) {
			//sintreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
        	recentreset = false;
	        Alltrees.switchdef(); 
			
        } else if(e.getSource() == sorc) {
			//sintreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
        	recentreset = false;
	        Alltrees.switchsorc(); 
			
        } else if(e.getSource() == zerk) {
			//sintreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
        	recentreset = false;
	        Alltrees.switchzerk(); 
			
        }
		// row1
        else if ((Sintree.getsinpoints() == 0 && Deftree.getdefpoints() == 0 && Sorctree.getsorcpoints() == 0 && Zerktree.getzerkpoints() == 0) || Sintree.getsinpoints() >= 10 || Deftree.getdefpoints() >= 10 ||
        		clertreepoints >= 10 || Sorctree.getsorcpoints() >= 10 || recentreset || Zerktree.getzerkpoints() >= 10) {
			if(e.getSource() == ligh) {
				if (light.getlv() < light.getmax() && light.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					light.setcurlv(light.getlv()+1);
					ligh.setToolTipText("<html>" + light.popup() + "</html>");
					lig.setText(light.getlv() + "/" + light.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == divin) {
				if (divine.getlv() < divine.getmax() && divine.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					divine.setcurlv(divine.getlv()+1);
					divin.setToolTipText("<html>" + divine.popup() + "</html>");
					divi.setText(divine.getlv() + "/" + divine.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == revit) {
				if (revita.getlv() < revita.getmax() && revita.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					revita.setcurlv(revita.getlv()+1);
					revit.setToolTipText("<html>" + revita.popup() + "</html>");
					revi.setText(revita.getlv() + "/" + revita.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == repercu) {
				if (repercus.getlv() < repercus.getmax() && repercus.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					repercus.setcurlv(repercus.getlv()+1);
					repercu.setToolTipText("<html>" + repercus.popup() + "</html>");
					reperc.setText(repercus.getlv() + "/" + repercus.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == divinema) {
				if (divinemas.getlv() < divinemas.getmax() && divinemas.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					divinemas.setcurlv(divinemas.getlv()+1);
					divinema.setToolTipText("<html>" + divinemas.popup() + "</html>");
					divinem.setText(divinemas.getlv() + "/" + divinemas.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row2
			else if(e.getSource() == focuse) {
				if (focused.getlv() < focused.getmax() && focused.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					focused.setcurlv(focused.getlv()+1);
					focuse.setToolTipText("<html>" + focused.popup() + "</html>");
					focus.setText(focused.getlv() + "/" + focused.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == endu) {
				if (endur.getlv() < endur.getmax() && endur.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					endur.setcurlv(endur.getlv()+1);
					endu.setToolTipText("<html>" + endur.popup() + "</html>");
					end.setText(endur.getlv() + "/" + endur.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == pleasur) {
				if (pleasure.getlv() < pleasure.getmax() && pleasure.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					pleasure.setcurlv(pleasure.getlv()+1);
					pleasur.setToolTipText("<html>" + pleasure.popup() + "</html>");
					pleasu.setText(pleasure.getlv() + "/" + pleasure.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row3
			else if(e.getSource() == judg) {
				if (judge.getlv() < judge.getmax() && judge.getpoints() <= clertreepoints && totalpoints > allpoints && light.getlv() > 0) {
					clertreepoints ++;
					allpoints ++;
					judge.setcurlv(judge.getlv()+1);
					judg.setToolTipText("<html>" + judge.popup() + "</html>");
					jud.setText(judge.getlv() + "/" + judge.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == copp) {
				if (cop.getlv() < cop.getmax() && cop.getpoints() <= clertreepoints && totalpoints > allpoints && divine.getlv() > 0) {
					clertreepoints ++;
					allpoints ++;
					cop.setcurlv(cop.getlv()+1);
					copp.setToolTipText("<html>" + cop.popup() + "</html>");
					coppp.setText(cop.getlv() + "/" + cop.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == cohh) {
				if (coh.getlv() < coh.getmax() && coh.getpoints() <= clertreepoints && totalpoints > allpoints && revita.getlv() > 0) {
					clertreepoints ++;
					allpoints ++;
					coh.setcurlv(coh.getlv()+1);
					cohh.setToolTipText("<html>" + coh.popup() + "</html>");
					cohhh.setText(coh.getlv() + "/" + coh.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == mindtr) {
				if (mindtra.getlv() < mindtra.getmax() && mindtra.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					mindtra.setcurlv(mindtra.getlv()+1);
					mindtr.setToolTipText("<html>" + mindtra.popup() + "</html>");
					mindt.setText(mindtra.getlv() + "/" + mindtra.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row4
			else if(e.getSource() == healin) {
				if (healing.getlv() < healing.getmax() && healing.getpoints() <= clertreepoints && totalpoints > allpoints && focused.getlv() > 0) {
					clertreepoints ++;
					allpoints ++;
					healing.setcurlv(healing.getlv()+1);
					healin.setToolTipText("<html>" + healing.popup() + "</html>");
					heali.setText(healing.getlv() + "/" + healing.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == dir) {
				if (dire.getlv() < dire.getmax() && dire.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					dire.setcurlv(dire.getlv()+1);
					dir.setToolTipText("<html>" + dire.popup() + "</html>");
					di.setText(dire.getlv() + "/" + dire.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == conce) {
				if (concen.getlv() < concen.getmax() && concen.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					concen.setcurlv(concen.getlv()+1);
					conce.setToolTipText("<html>" + concen.popup() + "</html>");
					conc.setText(concen.getlv() + "/" + concen.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == arbit) {
				if (arbitr.getlv() < arbitr.getmax() && arbitr.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					arbitr.setcurlv(arbitr.getlv()+1);
					arbit.setToolTipText("<html>" + arbitr.popup() + "</html>");
					arbi.setText(arbitr.getlv() + "/" + arbitr.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row5
			else if(e.getSource() == link) {
				if (links.getlv() < links.getmax() && links.getpoints() <= clertreepoints && totalpoints > allpoints && judge.getlv() > 0) {
					clertreepoints ++;
					allpoints ++;
					links.setcurlv(links.getlv()+1);
					link.setToolTipText("<html>" + links.popup() + "</html>");
					lin.setText(links.getlv() + "/" + links.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == recover) {
				if (recovery.getlv() < recovery.getmax() && recovery.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					recovery.setcurlv(recovery.getlv()+1);
					recover.setToolTipText("<html>" + recovery.popup() + "</html>");
					recove.setText(recovery.getlv() + "/" + recovery.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == orb) {
				if (orbs.getlv() < orbs.getmax() && orbs.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					orbs.setcurlv(orbs.getlv()+1);
					orb.setToolTipText("<html>" + orbs.popup() + "</html>");
					or.setText(orbs.getlv() + "/" + orbs.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == goddes) {
				if (goddess.getlv() < goddess.getmax() && goddess.getpoints() <= clertreepoints && totalpoints > allpoints && dire.getlv() > 0) {
					clertreepoints ++;
					allpoints ++;
					goddess.setcurlv(goddess.getlv()+1);
					goddes.setToolTipText("<html>" + goddess.popup() + "</html>");
					godde.setText(goddess.getlv() + "/" + goddess.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			}
			
			else if(e.getSource() == uplif) {
				if (uplift.getlv() < uplift.getmax() && uplift.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					uplift.setcurlv(uplift.getlv()+1);
					uplif.setToolTipText("<html>" + uplift.popup() + "</html>");
					upli.setText(uplift.getlv() + "/" + uplift.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row6
			else if(e.getSource() == whir) {
				if (whirl.getlv() < whirl.getmax() && whirl.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					whirl.setcurlv(whirl.getlv()+1);
					whir.setToolTipText("<html>" + whirl.popup() + "</html>");
					whi.setText(whirl.getlv() + "/" + whirl.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == salva) {
				if (salvat.getlv() < salvat.getmax() && salvat.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					salvat.setcurlv(salvat.getlv()+1);
					salva.setToolTipText("<html>" + salvat.popup() + "</html>");
					salv.setText(salvat.getlv() + "/" + salvat.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == swif) {
				if (swift.getlv() < swift.getmax() && swift.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					swift.setcurlv(swift.getlv()+1);
					swif.setToolTipText("<html>" + swift.popup() + "</html>");
					swi.setText(swift.getlv() + "/" + swift.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == pries) {
				if (priest.getlv() < priest.getmax() && priest.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					priest.setcurlv(priest.getlv()+1);
					pries.setToolTipText("<html>" + priest.popup() + "</html>");
					prie.setText(priest.getlv() + "/" + priest.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row7
			else if(e.getSource() == stor) {
				if (storm.getlv() < storm.getmax() && storm.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					storm.setcurlv(storm.getlv()+1);
					stor.setToolTipText("<html>" + storm.popup() + "</html>");
					sto.setText(storm.getlv() + "/" + storm.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == nimbl) {
				if (nimble.getlv() < nimble.getmax() && nimble.getpoints() <= clertreepoints && totalpoints > allpoints) {
					clertreepoints ++;
					allpoints ++;
					nimble.setcurlv(nimble.getlv()+1);
					nimbl.setToolTipText("<html>" + nimble.popup() + "</html>");
					nimb.setText(nimble.getlv() + "/" + nimble.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} 
			
			
			
        }
		if (clertreepoints == 5) {
			ImageIcon img = new ImageIcon(getClass().getResource("/cleric/possess.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        possess.setIcon((Icon) img);
	        img = new ImageIcon(getClass().getResource("/cleric/heal.png"));
	        test = img.getImage();
	        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
			heal1.setIcon((Icon) img);
		}
		if (clertreepoints == 10) {
			ImageIcon img = new ImageIcon(getClass().getResource("/cleric/stylemastery.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        cross.setIcon((Icon) img);
	        recentreset = false;
		}
		if (clertreepoints == 15) {
			ImageIcon img = new ImageIcon(getClass().getResource("/cleric/chainmastery.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        chain.setIcon((Icon) img);
	        img = new ImageIcon(getClass().getResource("/cleric/heal.png"));
	        test = img.getImage();
	        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
			heal2.setIcon((Icon) img);
		}
		if (clertreepoints == 20) {
			ImageIcon img = new ImageIcon(getClass().getResource("/cleric/holystriking.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        holy1.setIcon((Icon) img);
		}
		if (clertreepoints == 25) {
			ImageIcon img = new ImageIcon(getClass().getResource("/cleric/resurrect.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        res1.setIcon((Icon) img);
	        img = new ImageIcon(getClass().getResource("/cleric/heal.png"));
	        test = img.getImage();
	        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
			heal3.setIcon((Icon) img);
		}
		if (clertreepoints == 30) {
			ImageIcon img = new ImageIcon(getClass().getResource("/cleric/holystriking.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        holy2.setIcon((Icon) img);
		}
		if (clertreepoints == 35) {
			ImageIcon img = new ImageIcon(getClass().getResource("/cleric/resurrect.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        res2.setIcon((Icon) img);
		}
		allpoints = (clertreepoints+Sintree.getsinpoints()+Deftree.getdefpoints()+Sorctree.getsorcpoints()+Zerktree.getzerkpoints());
		if (allpoints == 40) {
			if (clertreepoints < 10 && Sintree.getsinpoints() < 10 && Sorctree.getsorcpoints() < 10 && Deftree.getdefpoints() < 10 && 
					Zerktree.getzerkpoints() < 10) {
				JOptionPane.showMessageDialog (null, "Error: Invalid Tree\nNone of the class trees has at least 10 points\n" +
						"Reseting",
		        			"Invalid", JOptionPane.ERROR_MESSAGE);
				Alltrees.resetall();
			}
		}
		cleric.setText("Cleric(" + clertreepoints + ")");
		
	}
	
	
	
	private static void createAndShowGUI() {

        JFrame.setDefaultLookAndFeelDecorated(true);
        frame = new JFrame("Cleric Skill Tree  by Avenaei(Andrew)");

        //Create and set up the content pane.
        Clertree demo = new Clertree();
        frame.setContentPane(demo.createContentPane());

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(560, 600);
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        frame.setLocation((dim.width/2)-(frame.getSize().width/2), dim.height/2-frame.getSize().height/2);
        frame.setVisible(true);
    }
	public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }

}
